home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / win / general / wsheap.exe / WSHEAP.H < prev    next >
Text File  |  1993-02-01  |  3KB  |  67 lines

  1. /********************************************************
  2. *                    WSHEAP.H 1.01                      *
  3. *        Copyright (c) TurboPower Software 1993.        *
  4. *                 All rights reserved.                  *
  5. ********************************************************/
  6.  
  7. #if !defined( __WSHEAP_H)
  8. #define __WSHEAP_H
  9.  
  10. #if !defined(EXPORT)
  11. #define EXPORT _export
  12. #endif
  13.  
  14. #if defined( __cplusplus )
  15. extern "C" {
  16. #endif  /* __cplusplus */
  17.  
  18. //Masks to enable suballocator analysis
  19. #define sfNone  0x0000             //no suballocators
  20. #define sfTPW   0x0001             //TPW heap block
  21. #define sfLH    0x0002             //Local heap block
  22. #define sfBC    0x0004             //BC heap block
  23. #define sfMSC   0x0008             //MSC heap block
  24. #define sfAll   0xFFFF             //all available suballocators
  25.  
  26. typedef struct TFlatArray          //used internally by WSHEAP
  27. {
  28.   WORD    aHandle;                 //handle of memory block
  29.   WORD    aSel;                    //selector of memory block
  30.   long    aCount;                  //current element count
  31.   long    aCapacity;               //current element capacity
  32.   WORD    aElSize;                 //element size; must be power of two
  33.   WORD    aElGrow;                 //number of elements to grow when needed
  34. };
  35.  
  36. typedef struct THeapState          //stores the heap state
  37. {
  38.   TFlatArray  hGlobal;             //global blocks
  39.   TFlatArray  hSub;                //suballocator blocks
  40.   WORD        hSubFlags;           //enabled suballocators
  41. };
  42. typedef THeapState FAR *PHeapState;
  43.  
  44. extern WORD FAR EXPORT PASCAL SaveHeapState(PHeapState HS, WORD SubFlags);
  45.   //-Save current heap state, returning 0 if successful
  46.  
  47. extern WORD FAR EXPORT PASCAL CompareHeapState(PHeapState HS,
  48.                                                LPSTR DumpFileName,
  49.                                                LPSTR DumpMsg);
  50.   //-Compare current heap state to saved state, returning status code
  51.  
  52. extern VOID FAR EXPORT PASCAL DoneHeapState(PHeapState HS);
  53.   //-Dispose of saved heap state
  54.  
  55. //Status codes returned by SaveHeapState and CompareHeapState:
  56. //          0      success
  57. //          8      insufficient memory
  58. //       8051      invalid FlatArray element size (internal error)
  59. //       8054      GlobalLock failure
  60. //       8500      local heap entries not in ascending order
  61. //       else      Turbo Pascal I/O result code
  62.  
  63. #if defined( __cplusplus )
  64. }
  65. #endif  /* __cplusplus */
  66. #endif  /* __WSHEAP_H */
  67.